﻿using System;

namespace CompareTwoArrays
{
    class Comparetwoarrays
    {
        static void Main(string[] args)
        {
            //May be solved with ten lines, but i'm playing ;) 
            Random rand = new Random();
            Console.WriteLine("Input what length of arrays you preffer:");
            int n = int.Parse(Console.ReadLine());
            int[] arrayA;
            arrayA = new int[n];
            int randomint = rand.Next(5, 15);
            for (int i = 0; i < arrayA.Length; i++)
            {
                
                arrayA[i] = i + randomint;
                Console.WriteLine("arrayA[{0}]={0}+{1}={2}", i, randomint, arrayA[i]);
                randomint = rand.Next(5,15);
            }
            Console.WriteLine(new string('-', 20));

            int[] arrayB;
            arrayB = new int[n];
            for (int i = 0; i < arrayB.Length; i++)
            {
                arrayB[i] = i + randomint;
                Console.WriteLine("arrayB[{0}] = {0} + {1} = {2}", i, randomint, arrayB[i]);
                randomint = rand.Next(5, 15);
            }
            Console.WriteLine(new string('-', 20));
            Array.Sort(arrayA);
            Array.Sort(arrayB);
            bool equalArrays = true;
            for (int i = 0; i < arrayA.Length; i++)
            {
                if (arrayA[i] != arrayB[i])
                {
                    equalArrays = false;
                    Console.WriteLine("arrayA[{0}] > arrayB[{0}] -> {1} > {2} -> equalsArray = {3}!", i, arrayA[i], arrayB[i],equalArrays);
                    break;
                }
                else
                {
                    Console.WriteLine("arrayA[{0}] = arrayB[{0}] -> {1} > {2} - equalsArray = {3}!", i, arrayA[i], arrayB[i], equalArrays);
                }
            }
        }
    }
}
